home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / BITSTR.ZIP / BITSTR_H.H < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-25  |  829 b   |  29 lines

  1. /*
  2.  
  3.   file    : bitstr_h.h
  4.   author  : Erik Mavrinac
  5.   version : 1.20  11/25/90
  6.  
  7.   description: Stand-alone header file that, by itself, allows use of the
  8.     bitstring functions. Do not use in conjunction with bitstr_f.c or
  9.     bitstr_f.h. See the bitstr.doc file for more details.
  10.  
  11. */
  12.  
  13. /* size of unsigned int in bits */
  14. #define US  16
  15.  
  16. /* CPU-specific hexadecimal definition of rightmost bit set (only) */
  17. #define HEX1  ((unsigned) 0x0001)
  18.  
  19.  
  20. /* void clear_bit(unsigned *bitstr, int bit) */
  21. #define clear_bit(x,y)  (*((x)+(y)/US) &= (~(HEX1 << (US-1-((y) % US)))))
  22.  
  23. /* void set_bit(unsigned *bitstr, int bit) */
  24. #define set_bit(x,y)  (*((x)+(y)/US) |= (HEX1 << (US-1-((y) % US))))
  25.  
  26. /* int test_bit(unsigned *bitstr, int bit) */
  27. #define test_bit(x,y)  (*((x)+(y)/US) & (HEX1 << (US-1-((y) % US))))
  28.  
  29.